package org.zoomdy.gdbserver.extender;

import java.util.*;


public class CtrlC extends Node
{
    public boolean start()
    {
        
        if(!super.start())
        {
            return false;
        }
        
        Runnable target = new Runnable()
        {
            public void run()
            {
                Scanner scanner = new Scanner(System.in);
                while(scanner.hasNext())
                {
                    String ctrlc = scanner.next();
                    if(ctrlc.equals("Ctrl+C"))
                    {
                        Packet pkt = Packet.makeCtrlCPacket();
                        CtrlC.this.outputCommand(pkt);
                    }
                }
            }
        };
        this.ctrlcThread = new Thread(target);
        this.ctrlcThread.start();
        
        return true;
    }
    
    public void stop()
    {
        super.stop();
    }
    
    public boolean inputCommand(Packet pkt)
    {
        return outputCommand(pkt);
    }
    
    public boolean inputResponse(Packet pkt)
    {
        return outputResponse(pkt);
    }
    
    private Thread ctrlcThread;
}
